package com.gdougms.service.Impl;

import com.gdougms.entity.User;
import com.gdougms.mapper.UserMapper;
import com.gdougms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getUsers() {
        return userMapper.getUsers();
    }

    @Override

    public int insertUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public User getUserByNumberOrIDCard(String num) {
        return userMapper.getUserByNumberOrIDCard(num);
    }

    @Override
    public User login(String num, String pwd) {
        return userMapper.login(num,pwd);
    }

    @Override
    public int register(String name, String id_card, String password, String email) {
        return userMapper.register(name,id_card,password,email);
    }

    @Override
    public int updatePassword(String password, String username) {
        return userMapper.updatePassword(password,username);
    }

    @Override
    public int bindEmail(String email, String number) {
        return userMapper.bindEmail(email,number);
    }

    @Override
    public List<User> getUserList() {
        return userMapper.getUserList();
    }

    @Override
    public int deleteUser(String username) {
        return userMapper.deleteUser(username);
    }

    @Override
    public int addUser(String name, String number, String idCard, String password, int role,String email) {
        return userMapper.addUser(name,number,idCard,password,role,email);
    }

    @Override
    public int updateUser(String name, String number, String idCard, String password, String email, int id) {
        return userMapper.updateUser(name, number, idCard, password, email, id);
    }

    @Override
    public User getIfUserById(int id) {
        return userMapper.getIfUserById(id);
    }

    @Override
    public String userIfBindEmail(String number) {
        return userMapper.userIfBindEmail(number);
    }


}
